//
//  PHDevice.h
//  PhnixHome
//
//  Created by Levy Xu on 2018/1/4.
//  Copyright © 2018年 Levy Xu. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "PHAnalysis.h"
#import "PHConstant.h"

#define kPointCodes_BG @[ POWER, MODE, CURRENT_TEMP]

#define kPointCodes_Detail @[ TIMER1_ON, TIMER1_OFF, TIMER2_ON, TIMER2_OFF, TARGET_TEMP, DEINFECT, FAULT1, FAULT2, MAX_TEMP, MIN_TEMP, TOTALTIME ]

#define kPointCodes_Time @[ SYS_YEAR, SYS_MONTH, SYS_DAY, SYS_HOUR, SYS_MINUTE, SYS_SECOND, SYS_WEEK ]

typedef enum : NSUInteger {
    PHDeviceTypeWaterHeater = 1,
    PHDeviceTypeWaterPurifier,
    PHDeviceTypeHeatPump,
} PHDeviceType;

@interface PHDevice : NSObject

@property(nonatomic, strong) NSString *device_name;
@property(nonatomic, strong) NSString *device_code;
@property(nonatomic, assign) NSInteger device_type;
@property(nonatomic, strong) NSString *is_online;
@property(nonatomic, strong) NSString *device_nick_name;

@property(nonatomic, assign) BOOL needDetail;

-(UIImage *)displayImage;

-(NSString *)displayName;

-(BOOL)equalTo:(PHDevice *)device;

-(float)floatWithCode:(NSString *)code;

-(NSInteger)intWithCode:(NSString *)code;

#pragma mark - Timer

-(void)startTimer;

-(void)stopTimer;

-(void)fireTimer;

#pragma mark - Analysis

-(NSArray *)electricitiesThisMonth;

-(float)electricityYestoday;

-(float)totalElectThisMonth;

-(NSArray *)electricityForDays:(NSInteger)days;

-(float)totalElectSavedThisMonth;

-(void)getElectricityTwoMonth:(FinishBlock)finish;

-(void)getCOPThisMonth:(FinishBlock)finish;

#pragma mark - Networking

//网络接口
-(void)modifyNickname:(NSString *)nickname finish:(FinishBlock)finish;

-(void)bind:(FinishBlock)finish;

-(void)unbind:(FinishBlock)finish;

-(void)request:(NSArray *)array animated:(BOOL)animated finish:(FinishBlock)finish;

-(void)getStatus:(BOOL)animated finish:(FinishBlock)finish;

-(void)modify:(NSDictionary *)dict animated:(BOOL)animated finish:(FinishBlock)finish;

-(void)analysis:(NSString *)code start:(NSDate *)start end:(NSDate *)end finish:(void (^)(NSArray *result))finish;

@end
